//
//  LTClassAPIManager.m
//  LearnTeacher
//
//  Created by zyl_macbookpro on 2024/4/11.
//

#import "LTClassAPIManager.h"

@implementation LTClassAPIManager
+ (void)getClassListWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_INDEX_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
    
}

+ (void)getClassInfoWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_INFO_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)addGroupWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_ADDGROUP_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)resetPwdWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_RESETPWD_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)getHomeworkWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_HOMEWORK_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
        if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)getMachineReportWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_MACHINE_URL];
    [BaseRequest baseGET:url cache:NO autoHideLoading:NO parms:param request:^(id resultObject, NSError *error) {
        if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)changeClassWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_EDITGRADE_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
+ (void)deleteGroupWithParam:(NSDictionary *)param result:(void(^)(NSDictionary *dic))resultBlock
{
    NSString *url = [NSString stringWithFormat:@"%@%@",BASE_URL,CLASS_DELGROUP_URL];
    [BaseRequest basePOST:url cache:NO autoHideLoading:NO parms:param result:^(id resultObject, NSError *error) {
       if (resultObject&&[resultObject[@"code"] doubleValue] == 1) {
            resultBlock(resultObject);
        }else{
            NSDictionary *dic = (NSDictionary *)resultObject;
            [SVProgressHUD showImage:nil status:dic[@"msg"]];
        }
    }];
}
@end
